#include "YWGameImageMath.h"
#include <sstream> 
#include <string>

YWGameImageMath::YWGameImageMath()
{
	m_pLabel = NULL;
	m_iNum = 0;
}

YWGameImageMath::~YWGameImageMath()
{

}

bool YWGameImageMath::init(CCPoint myPos)
{
	m_pLabel=CCLabelAtlas::labelWithString("0", "pro/num.png", 64, 64, '0');
	m_pLabel->setPosition(myPos);
	return true;
}

void YWGameImageMath::SetNum(float iVar)
{
	m_iNum = iVar;
	std::stringstream out;
	std::string str;
	out << ((int)m_iNum);
	out >> str;
	m_pLabel->setString(str.c_str());
}

int YWGameImageMath::GetNum()
{
	return m_iNum;
}

void YWGameImageMath::ChangeNum( float iVar )
{
	m_iNum = m_iNum + iVar;
	std::stringstream out;
	std::string str;
	out << ((int)m_iNum);
	out >> str;
	m_pLabel->setString(str.c_str());
}

CCLabelAtlas* YWGameImageMath::GetNode()
{
	return m_pLabel;
}
